class CreateDidiliesPaths < ActiveRecord::Migration
    def self.up
        create_table "didilies_paths", :id => false, :force => true do |t|
            t.column "path_id", :int
            t.column "didily_id", :int
            
        end    
        
        add_index :didilies_paths, :didily_id
        add_index :didilies_paths, :path_id            
        
        execute "ALTER TABLE didilies_paths ADD CONSTRAINT didilies_paths_path_id_fkey FOREIGN KEY (path_id) REFERENCES paths (id) ON DELETE CASCADE ON UPDATE CASCADE"
        execute "ALTER TABLE didilies_paths ADD CONSTRAINT didilies_paths_didily_id_fkey FOREIGN KEY (didily_id) REFERENCES didilies (id) ON DELETE CASCADE ON UPDATE CASCADE"           
    end
    
    def self.down
        drop_table "didilies_paths"
    end
end
